﻿using SchoolDatabase;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

namespace TestSchoolDatabase
{
    
    
    /// <summary>
    ///This is a test class for StudentTest and is intended
    ///to contain all StudentTest Unit Tests
    ///</summary>
    [TestClass()]
    public class StudentTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Student Constructor
        ///</summary>
        [TestMethod()]
        public void StudentConstructorTest()
        {
            string name = "ivan ivanov ivanov"; // TODO: Initialize to an appropriate value
            int number = 10; // TODO: Initialize to an appropriate value
            string gender = "male"; // TODO: Initialize to an appropriate value
            //Student target = new Student(name, number, gender);
            Student_Accessor target = new Student_Accessor(name, number, gender);
            Assert.AreEqual(target.name, name , "Name not match");
            Assert.AreEqual(target.number, number , "number not match");
            Assert.AreEqual(Student_Accessor.Gender.male, target.gender , "gender not match");
        }
         [TestMethod()]
        public void StudentConstructorTest2()
        {
            string name = "elena elenova"; // TODO: Initialize to an appropriate value
            int number = 5; // TODO: Initialize to an appropriate value
            string gender = "female"; // TODO: Initialize to an appropriate value
            //Student target = new Student(name, number, gender);
            Student_Accessor target = new Student_Accessor(name, number, gender);
            Assert.AreEqual(target.name, name, "Name not match");
            Assert.AreEqual(target.number, number, "number not match");
            Assert.AreEqual(Student_Accessor.Gender.female, target.gender, "gender not match");
        }

         [TestMethod()]
         [ExpectedException(typeof(InvalidStudentException))]
         public void StudentConstructorTestInvalidGender()
         {
             string name = "elena elenova";
             int number = 5;
             string gender = "InvalidGender";             
             //Student target = new Student(name, number, gender);             
             Student_Accessor target = new Student_Accessor(name, number, gender);
         }

         [TestMethod()]
         [ExpectedException(typeof(InvalidStudentException))]
         public void StudentConstructorTestInvalidNumber()
         {
             string name = "elena elenova";
             int number = 0;
             string gender = "famale";
             //Student target = new Student(name, number, gender);             
             Student_Accessor target = new Student_Accessor(name, number, gender);
         }

         [TestMethod()]
         [ExpectedException(typeof(InvalidStudentException))]
         public void StudentConstructorTestInvalidName()
         {
             string name = "a";
             int number = 5;
             string gender = "male";
             //Student target = new Student(name, number, gender);             
             Student_Accessor target = new Student_Accessor(name, number, gender);
         }
    }
}
